{% extends 'base.html' %}

{% block content %}
<div class="container mt-4">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <h2>{{ template.title }}</h2>
            <p class="text-muted">提交记录列表</p>
        </div>
        <div>
            <a href="{% url 'form_detail' template.id %}" class="btn btn-primary">
                <i class="bi bi-plus-lg"></i> 新建提交
            </a>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-body">
                    {% if submissions %}
                        <div class="table-responsive">
                            <table class="table table-hover">
                                <thead>
                                    <tr>
                                        <th>提交时间</th>
                                        <th>提交人</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {% for submission in submissions %}
                                    <tr>
                                        <td>{{ submission.submitted_at|date:"Y-m-d H:i" }}</td>
                                        <td>{{ submission.submitted_by.username }}</td>
                                        <td>
                                            <a href="{% url 'submission_detail' submission.id %}" 
                                               class="btn btn-sm btn-outline-primary">
                                                查看详情
                                            </a>
                                        </td>
                                    </tr>
                                    {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    {% else %}
                        <div class="text-center text-muted py-5">
                            <p>暂无提交记录</p>
                            <a href="{% url 'form_detail' template.id %}" class="btn btn-primary">
                                立即提交
                            </a>
                        </div>
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 